package cn.zd.demo.flink.statebackend;

import cn.zd.demo.flink.statebackend.constant.ConfigConstant;
import cn.zd.demo.flink.statebackend.dto.CustBaseInfoDTO;
import cn.zd.demo.flink.statebackend.dto.CustExtendInfoDTO;
import cn.zd.demo.flink.statebackend.dto.CustInfoDTO;
import com.alibaba.fastjson2.JSON;
import sun.security.provider.MD5;

import java.sql.*;
import java.util.Random;

public class TestData {
    public static void main(String[] args) throws SQLException {
        /*String custNo="123456";
        CustBaseInfoDTO infoDTO = new CustBaseInfoDTO();
        infoDTO.setCustNo(custNo);
        infoDTO.setCustName("张三");
        infoDTO.setCustIdNo(String.format(custNo+"-%d",new Random().nextInt(100)));
        infoDTO.setSex(new Random().nextInt(2)%2);

        CustExtendInfoDTO extendInfoDTO = new CustExtendInfoDTO();
        extendInfoDTO.setCustNo(custNo);
        extendInfoDTO.setOrgNo(String.format("NO:%d-%s",new Random().nextInt(100),custNo));
        extendInfoDTO.setRemark("mark");

        System.out.println("infoDTO:\t" + JSON.toJSONString(infoDTO));
        System.out.println("extendInfoDTO:\t" + JSON.toJSONString(extendInfoDTO));
        CustInfoDTO dto = new CustInfoDTO();
        dto.setBaseInfoDTO(infoDTO);
        dto.setExtendInfoDTO(extendInfoDTO);
        System.out.println("extendInfoDTO:\t" + JSON.toJSONString(dto));
        System.out.println(JSON.parseObject("{\"custNo\":\"8888\",\"orgNo\":\"NO:73-123456\",\"remark\":\"mark\"}", CustExtendInfoDTO.class));
        System.out.println(JSON.parseObject("{\"custNo\":\"8888\",\"orgNo\":\"NO:73-123456\",\"remark\":\"mark\"}", CustBaseInfoDTO.class));*/
        /*Connection connection = DriverManager.getConnection(ConfigConstant.DB.URL,ConfigConstant.DB.USERNAME,ConfigConstant.DB.USERPWD);
        PreparedStatement statement = connection.prepareStatement("insert into tbl_cust_info (cust_No, cust_name, cust_id_no, sex, org_no, remark, c_date) values (?, ?, ?, ?, ?, ?, ?)");
        statement.setObject(1, "00001");
        statement.setObject(2, "CUSTNO0001");
        statement.setObject(3, Long.valueOf("0.01"));
        statement.setObject(4, 1);
        statement.setObject(5, "BK0001");
        statement.setObject(6, "SQL insert ");
        statement.setObject(7, new Timestamp(System.currentTimeMillis()));
        statement.execute();
        statement.close();
        connection.close();*/

    }
}
